

#include <string>

# include "camera_reader.h"
# include "image.h"
# include "image_processor.h"
# include "init_systems.h"
# include "jpeg_buffer.h"
# include "printfstring.h"
# include "log.h"
# include "time_tools.h"

# include "basic_processor.h"

using namespace std;
using namespace kthrobot;

class camera_task {

public:
  string ip;
  JPEGBuffers jpeg_buffers;
  JPEGQueue jpeg_queue;
  basic_processor img_processor;

  camera_task( string ip_adress ) {
    ip = ip_adress;
    capture_and_process();
  }

   virtual ~camera_task() {}

   void capture_and_process() {
     {
       CameraReader cam_reader(ip, &jpeg_buffers, &jpeg_queue);
       ImageProcessor processor(&jpeg_queue, &img_processor);
       cam_reader.Start();
       processor.Start();
       TimeTools::WaitSecs(120);
       cam_reader.SignalStop();
       processor.SignalStop();
     }
   }

 };
